//
//  KABRecAddressTCell.m
//  kabu
//
//  Created by XiangDongMBP on 2017/2/12.
//  Copyright © 2017年 East. All rights reserved.
//

#import "KABRecAddressTCell.h"
#import "KABModel.h"

@implementation KABRecAddressTCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
//    self.addressBtn.titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
//    self.addressBtn.titleLabel.numberOfLines = 2;
    
    [self.defaultBtn addTarget:self action:@selector(defaultBtnTapped:) forControlEvents:UIControlEventTouchUpInside];
    [self.deleteBtn addTarget:self action:@selector(deleteBtnTapped:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)defaultBtnTapped:(UIButton *)btn {
    if ([self.delegate respondsToSelector:@selector(kABRecAddressTCell:defaultBtnTapped:)]) {
        [self.delegate kABRecAddressTCell:self defaultBtnTapped:btn];
    }
}

- (void)deleteBtnTapped:(UIButton *)btn {
    if ([self.delegate respondsToSelector:@selector(kABRecAddressTCell:deleteBtnTapped:)]) {
        [self.delegate kABRecAddressTCell:self deleteBtnTapped:btn];
    }
}

- (void)configViewWithRecInfoItem:(KABReceiverInfoItem *)item {
    self.nameLabel.text = item.receiver_name;
    
//    NSString *phoneStr = [NSString stringWithFormat:@"   %@", item.receiver_phone];
//    [self.phoneBtn setTitle:phoneStr forState:UIControlStateNormal];
    self.phoneLabel.text = item.receiver_phone;
    
    NSString *address = [NSString stringWithFormat:@"%@ %@ %@", item.province, item.city, item.address];
    self.addressLabel.text = address;
//    [self.addressBtn setTitle:address forState:UIControlStateNormal];
    
    self.defaultBtn.selected = item.is_default;
}

@end
